#ifndef __WEBPAGE_H__
#define __WEBPAGE_H__
#include "Configuration.h"
#include "cppjieba/Jieba.hpp"
#include <string>
#include <vector>
#include <map>
#include <set>
using std::set;
using std::map;
using std::vector;
using std::string;
using WordSegmentation = cppjieba::Jieba;
class WebPage
{
    friend bool operator==(const WebPage &lhs, const WebPage &rhs);
    friend bool operator<(const WebPage &lhs, const WebPage &rhs);
public:
    WebPage(string &doc, Configuration &config, WordSegmentation &jieba);
    int getDocId() { return _docId; }
    string getTile() { return _docTitle; }
    string summary(const vector<string> &queryWords);
    map<string, int> &getWordsMap() {return _wordsMap;}
    void processDoc(const string &doc);
    void calcTopK(vector<string> &wordsVec, int k, set<string> &stopWordList);

public:
    int _docId;
    string _docTitle;
    string _docUrl;
    string _docContent;
    string _docSummary;
private:
    const static int TOPK_NUMBER = 20;
    vector<string> _topWords;
    map<string, int> _wordsMap;

};
#endif

